package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[] arr={"a","b","c","d","e"};
        for(int i=0;i<arr.length;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.println();
        for(String str : arr){
            System.out.print(str+" ");
        }

        System.out.println();
        Collection<String> c=new ArrayList<>();
        c.add("a");
        c.add("b");
        c.add("c");
        c.add("d");
        c.add("e");
        Iterator<String> it=c.iterator();
        while(it.hasNext()){
            String str=it.next();
            System.out.print(str+" ");
        }
        System.out.println();
        for(String str:c){
            System.out.print(str+" ");
        }

    }
}
